#include "Widgets/Switcher/WidgetSwitcher.h"



void RWidgetSwitcher::PaintSubWidgets(uint16_t& InZOrder)
{
    if(CurrentSubWidget )
    {
        if(CurrentSubWidget->GetParent().Get()==this)
        {
            CurrentSubWidget->Paint(InZOrder);
        }
        else
        {
            assert(false && "CurrentSubWidget must be subwidget of RWidgetSwitcher");
        }
    }
}

void RWidgetSwitcher::SetCurrentSubWidget(RWidgetPtr InWidget)
{
    if(CurrentSubWidget!=InWidget)
    {
        CurrentSubWidget=InWidget;
        OnChildChanged.Broadcast();
    }
}

RWidgetPtr RWidgetSwitcher::GetCurrentSubWidget()
{
    return CurrentSubWidget;
}